<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <search :config="searchConfig" @search="search" @getHeight="getHeight" />

    <!-- table区域-begin -->
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-94'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :toolbar-config="tableToolbar"
        :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all="selectChangeEvent"
      >
        <template #toolbar_buttons >
          <!-- 操作按钮区域 -->
          <div class="table-operator">
            <a-button type='primary' v-has="'ordermgt:export'" @click="downExportXls('delivery_detail' )">导出</a-button>
          </div>
        </template>
        <template #agentOrderStatus="{ row,rowIndex }">
          {{ filterDictText(fhlist, row.agentOrderStatus) }}
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <form-add-edit ref='popupForm' @ok='loadData'></form-add-edit>
    <business-log ref='businessLog'></business-log>
  </a-card>
</template>

<script>
import ordermgtModal from './TerminalOrderModal/ordermgtModal.vue'
import { PageListMixin } from '@/mixins/PageListMixin'
import { getAction, postAction } from '@api/manage'
import { initDictOptions, filterDictText} from '@/components/dict/CnDictSelectUtil'

import Vue from 'vue'
export default {
  name: 'userorgerl',
  mixins: [PageListMixin],
  components: {
    ordermgtModal
  },
  data() {
    return {
      selectedRowKeys: [],
      description: '代配送发货明细',
      searchConfig: [
        {
          // label:'区域编号',
          type: 'input',
          name: 'orderCode',
          placeholder: ' DMS订单编号'
        }, {
          type: 'input',
          name: 'customerCode',
          placeholder: '客户编号',
        },
        {
          // label:'区域编号',
          type: 'input',
          name: 'customerName',
          placeholder: '客户名称'
        },
        {
          // label:'区域编号',
          type: 'input',
          name: 'productCode',
          placeholder: '商品编号'
        },
        {
          // label:'区域编号',
          type: 'input',
          name: 'productName',
          placeholder: '商品名称'
        },
        {
          type: 'input',
          name: 'updateName',
          placeholder: '发货方',
        },
      ],
      //表头
      columns: [],
      fhlist:[],
      //列设置
      settingColumns: [],
      columns: [
        { type: 'checkbox', width: 60, fixed: 'left' },
        {
          title: '订单编号',
          align: 'left',
          field: 'orderCode',
          minWidth: 80,
        },
        {
          title: '客户编号',
          align: 'left',
          field: 'customerCode',
          minWidth: 80,
        },
        {
          title: '客户名称',
          align: 'left',
          field: 'customerName',
          minWidth: 80,
        },
        {
          title: '商品编号',
          align: 'left',
          field: 'productCode',
          minWidth: 80,
        }
        ,{
          title: '商品名称',
          align: 'left',
          field: 'productName',
          minWidth: 80,
        },
        ,{
          title: '原始订单号',
          align: 'left',
          field: '',
          minWidth: 100,
        },
        ,{
          title: '原始订单数量',
          align: 'left',
          field: '',
          minWidth: 100,
        },
        ,{
          title: '订单数量',
          align: 'left',
          field: 'orderNum',
          minWidth: 80,
        },
        ,{
          title: '发货数量',
          align: 'left',
          field: 'deliverNum',
          minWidth: 80,
        },
        {
          title: '签收数量',
          align: 'left',
          field: 'signForNum',
          minWidth: 80,
        },
        ,{
          title: '发货状态',
          align: 'left',
          field: 'agentOrderStatus',
          minWidth: 80,
          slots: { default: 'agentOrderStatus' }
        },
        ,{
          title: '发货日期',
          align: 'left',
          field: 'deliverTime',
          minWidth: 80,
        },
        {
          title: '发货方',
          align: 'left',
          minWidth: 80,
          field: 'createName'
        }
      ],
      isorter: {
        permflag: 'delivery_detail_impl'
      },
      url: {
        list: window._CONFIG['domianDmsURL'] + '/order/dmsPreparationDeliveryInformation/findAgentOrderPageList',
        // detail: window._CONFIG['domianURL'] + '/userorgrelation/cnUserOrgRelation/saveOrUpdate',
        // edit: window._CONFIG['domianURL'] + '/mdsProduct/saveOrUpdateEntity',
        // deleteBatch: '/userorgrelation/cnUserOrgRelation/deleteBatch',
        // delete: window._CONFIG['domianURL'] + '/userorgrelation/cnUserOrgRelation/delete',
        // exportXlsUrl: window._CONFIG['domianTpmURL'] + 'budget/tpmBudgetFee/exportXls'
      }
    }
  },
  methods: {
    filterDictText,
    initDictConfig() {
      initDictOptions('agent_order_status').then((res) => {
        if (res.success) {
          this.fhlist = res.result
        }
      })
    },
  }
}
</script>

<style>
</style>
